#include "HNHomeScence.h"

#include "Game/Widget/WidgetManager.h"

#include "GameLib/Game/GameLib.h"
#include "Game/Game/MissionWeiXin.h"

#include "HNScenceManager.h"

void HNHomeScence::init_Button()
{
	WidgetManager::addButtonCB("Button_GameRoom",this,button_selector(HNHomeScence::Button_GameRoom));
	WidgetManager::addButtonCB("Button_BackHome",this,button_selector(HNHomeScence::Button_BackHome));
	WidgetManager::addButtonCB("Button_HomeHead",this,button_selector(HNHomeScence::Button_HomeHead));
	WidgetManager::addButtonCB("Button_HomeAddGold",this,button_selector(HNHomeScence::Button_HomeAddGold));
	WidgetManager::addButtonCB("Button_HomeExit",this,button_selector(HNHomeScence::Button_HomeExit));
	WidgetManager::addButtonCB("Button_SetChannel",this,button_selector(HNHomeScence::Button_SetChannel));
	WidgetManager::addButtonCB("Button_wanfa",this,button_selector(HNHomeScence::Button_wanfa));
	WidgetManager::addButtonCB("Button_ExitLogon",this,button_selector(HNHomeScence::Button_ExitLogon));

	WidgetManager::addButtonCB("Button_sharePengYou",this,button_selector(HNHomeScence::Button_sharePengYou));
	WidgetManager::addButtonCB("Button_shareQuan",this,button_selector(HNHomeScence::Button_shareQuan));

	WidgetManager::addButtonCB("button_laizi",this,button_selector(HNHomeScence::button_laizi));
	WidgetManager::addButtonCB("button_guangdong",this,button_selector(HNHomeScence::button_guangdong));
	
}
void HNHomeScence::Button_GameRoom(cocos2d::Ref*,WidgetUserInfo* pUserInfo)
{
	int iServerID = utility::parseInt(WidgetFun::getUserInfoValue(pUserInfo,"GameServerID"));
}
void HNHomeScence::Button_BackHome(cocos2d::Ref*,WidgetUserInfo*)
{
	GameManagerBase::InstanceBase().disconnectServer();
	HNScenceManager::Instance().InHomeScence();
}
void HNHomeScence::Button_HomeHead(cocos2d::Ref*,WidgetUserInfo*)
{
	WidgetFun::setVisible(this,"PlayerInfoNode",true);
	WidgetFun::setText(this,"PopName",UserInfo::Instance().getUserNicName());
	WidgetFun::setText(this,"PopID",utility::paseInt(UserInfo::Instance().getUserID(),6));
	WidgetFun::setText(this,"PopIP",UserInfo::Instance().getUserIP());
	ImagicDownManager::Instance().addDown(WidgetFun::getChildWidget(this,"PopHeadImagic"),
		UserInfo::Instance().getHeadHttp(),UserInfo::Instance().getUserID());

}
void HNHomeScence::Button_HomeAddGold(cocos2d::Ref*,WidgetUserInfo*)
{
	WidgetFun::setVisible(this,"BuyPlane",true);
}
void HNHomeScence::Button_HomeExit(cocos2d::Ref*,WidgetUserInfo*)
{

}
void HNHomeScence::Button_SetChannel(cocos2d::Ref*,WidgetUserInfo*)
{
}
void HNHomeScence::Button_wanfa(cocos2d::Ref*,WidgetUserInfo*)
{
	WidgetFun::setVisible(this,"WanFaNode",true);
}
void HNHomeScence::Button_ExitLogon(cocos2d::Ref*,WidgetUserInfo*)
{
	WidgetFun::setVisible(this,"PlayerInfoNode",false);
	HNScenceManager::Instance().InLogonScence();
	MissionWeiXin::Instance().restWeiXin();
}
void HNHomeScence::Button_sharePengYou(cocos2d::Ref*,WidgetUserInfo*)
{
	MissionWeiXin::Instance().shareUrlWeiXin(utility::getScriptString("HomeWeiXinSharUrl"),
		utility::getScriptString("HomeWeiXinSharTitle"),
		utility::getScriptString("HomeWeiXinSharDes"),MissionWeiXin::SHARE_SESSION);
}
void HNHomeScence::Button_shareQuan(cocos2d::Ref*,WidgetUserInfo*)
{
	MissionWeiXin::Instance().shareUrlWeiXin(utility::getScriptString("HomeWeiXinSharUrl"),
		utility::getScriptString("HomeWeiXinSharTitle"),
		utility::getScriptString("HomeWeiXinSharDes"),MissionWeiXin::SHARE_MOMENTS);
}